package com.gxa.controller.shezhicontroller;

import com.gxa.common.R;
import com.gxa.pojo.ZhiYuan;
import com.gxa.service.shezhiservice.ZhiYuanService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author weishen
 */
@RestController
@RequestMapping("/ZhiYuan")
@Api(value = "职员管理" , tags = "职员数据接口API")
@RequiresPermissions("职员管理")
public class ZhiYuanController {

    @Autowired(required = false)
    public R r;
    @Autowired
    ZhiYuanService zhiYuanService;
    @GetMapping("/selectAllZhiYuanForPage")
    @ApiOperation(value = "查询所有职员信息接口",notes = "提供页码和每页显示数",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码数",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "size",value = "每页显示数",required = true,dataType = "int",paramType = "query"),

    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectAllZhiYuanForPage(@RequestParam int page,@RequestParam int size)
    {
        return zhiYuanService.selectAllZhiYuanForPage(page, size);
    }
    @PostMapping("/updateZhiYuanById")
    @ApiOperation(value="修改职员信息接口",notes = "提供职员信息",httpMethod = "post",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R updateZhiYuanById(@RequestBody ZhiYuan zhiYuan)
    {

       return zhiYuanService.updateZhiYuanById(zhiYuan);
    }
    @PostMapping("/insertZhiYuan")
    @ApiOperation(value="新增职员接口",notes="提供职员信息",httpMethod = "post",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R insertZhiYuan(@RequestBody ZhiYuan zhiYuan)
    {
       return zhiYuanService.insertZhiYuan(zhiYuan);
    }
    @PostMapping("/deleteZhiYuanById")
    @ApiOperation(value = "删除职员接口",notes = "提供职员id",httpMethod = "get",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R deleteZhiYuanById(@RequestParam ArrayList<Integer> id)
    {
        return zhiYuanService.deleteZhiYuanById(id);
    }
}
